package com.t2t.top.devops.util;


import com.t2t.top.devops.constant.BugLevel;

import java.util.*;

/**
 * Created by yangpengfei on 2015/12/1.
 */
public class FunctionsUtils {
    /**
     * 根据日期获得星期
     */
    public static String getWeekOfDate(Date date) {
        String[] weekDaysName = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        String[] weekDaysCode = {"0", "1", "2", "3", "4", "5", "6"};
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int intWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
        return weekDaysName[intWeek];
    }

    public static List bugLevels() {
        BugLevel[] types = BugLevel.values();
        List list = new ArrayList();
        for (BugLevel buglevel : types) {
            Map map = new HashMap();
            map.put("value", buglevel.TYPE);
            map.put("text", buglevel.DESC);
            map.put("desc", buglevel.DESC + "(" + buglevel.toString() + ")");
            list.add(map);
        }
        return list;
    }

}
